<!--<template>-->
<!--  -->
<!--</template>-->
<template>
  <div class="app-container">
          <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="检测图" name="first">
                <el-row>
                  <el-col>
                    <div class="grid-content bg-purple-dark" style="text-align: right">
                    <el-button type="warning" style="text-align: center">刷新时间设置</el-button>
                    </div>
                  </el-col>
                </el-row>
                  <svg-icon v-bind:iconClass="imgShow.realName" className='icon'></svg-icon>
            </el-tab-pane>
            <el-tab-pane label="报表" name="second">
              <real-time-index ref="realTimeIndex" :svgId="1962"></real-time-index>
            </el-tab-pane>
            <el-tab-pane label="趋势图" name="third">趋势图</el-tab-pane>
            <el-tab-pane label="报警记录" name="fourth">
              <history-alarm-note ref="historyAlarmNote" :svgId="1962"></history-alarm-note>
            </el-tab-pane>
          </el-tabs>
  </div>
</template>

<style scoped>
  .icon {
    width: 970px;
    height: 550px;
  }
</style>
<script>
    import {
        listEquipmentfile,
    } from "@/api/basicSetup/equipmentfile";
    import HistoryAlarmNote from "../../../energyAlarm/historicalAlarm/historyAlarmNote";
    import realTimeIndex from "../../../energyStatistics/energyStatisticsTrend/realTimeIndex";
    export default {
      components: {HistoryAlarmNote,realTimeIndex},
      comments:{HistoryAlarmNote},
        watch: {
            filterText(val) {
                this.$refs.tree.filter(val);
            }
        },
        data() {
            var choiceIndex;
            var Indexid;
            return {
                //右边菜单栏
                activeName: '实时监测',
                // 遮罩层
                loading: true,
                // 选中数组
                ids: [],
                // 非单个禁用
                single: true,
                // 非多个禁用
                multiple: true,
                // 总条数
                total: 0,
                activeName:"first",
                //
                imgShow: {
                  realName:undefined
                },
                // 组态图表格数据
                equipmentfileList: [],
                //测点表格数据
                equipmentfilecdList: [
                    choiceIndex = ""
                ],
                // 弹出层标题
                title: "",
                // 是否显示弹出层
                open: false,
                footopen: false,
                addImgOpen: false,
                uploadOpen: false,
                indexLoading: false,
                //组态图选择指标
                statisticIndexDialog: false,
                //组态图测点弹出层
                imgcdopen: false,
                // ID字典
                fileidOptions: [],
                // 文件名称字典
                filenameOptions: [],
                // 文件编号字典
                filenoOptions: [],
                // 操作人字典
                opomanOptions: [],
                // 操作时间字典
                opotimeOptions: [],
                // 文件路径字典
                filepathOptions: [],
                // 备注字典
                noteOptions: [],
                settingStatisticIndexList: [],
                // 表单参数
                form: {},
                // 表单校验
                rules: {
                    filename: [
                        {required: true, message: "文件名称不能为空", trigger: "blur"}
                    ], fileno: [
                        {required: true, message: "文件编号不能为空", trigger: "blur"}
                    ],
                },
                filterText: '',
                svgData:[{
                    id:1,
                    label:"生产企业",
                    children:[{
                        id:2,
                        label:"水系统",
                    },{
                        id:3,
                        label: "电系统",
                    }],
                }],
                defaultProps: {
                    children: 'children',
                    label: 'label'
                },
            };
        },
        created() {
            this.getList();
            this.imgShow.realName = this.modelCode=this.$route.query.realName;
          console.log("this.imgShow.realName="+this.imgShow.realName);
        },
        methods: {
            //通过
            handleClick(tab, event) {
                console.log("tab=="+tab, event.toString());
            },
            //切换组态图查看
            updateImg(row){
                var pos = row.filepath.lastIndexOf('/');
                var str = row.filepath.substr(pos+1);
                // this.imgShow.realName = str.substring(0,str.length-4);
                // console.log(this.imgShow.realName);
            },
            //通过关键字进行过滤组态图
            filterNode(value, data) {
                if (!value) return true;
                return data.label.indexOf(value) !== -1;
            },
            /** 查询组态图列表 */
            getList() {
                this.loading = true;
                listEquipmentfile(this.queryParams).then(response => {
                    this.equipmentfileList = response.rows;
                    this.total = response.total;
                    this.loading = false;
                });
            },
            // 取消按钮
            cancel() {
                this.open = false;
                this.reset();
            },
            // 表单重置
            reset() {
                this.form = {
                    fileid: undefined,
                    filename: undefined,
                    fileno: undefined,
                    opoman: undefined,
                    opotime: undefined,
                    filepath: undefined,
                    note: undefined,
                    img: undefined
                };
                this.resetForm("form");
            },
            /** 搜索按钮操作 */
            handleQuery() {
                this.queryParams.pageNum = 1;
                this.getList();
            },
            /** 重置按钮操作 */
            resetQuery() {
                this.resetForm("queryForm");
                this.handleQuery();
            },
        }
    };
</script>
